package com.itany.dao.impl;

import com.itany.dao.UserDao;
import com.itany.entity.User;
import com.itany.jdbc.core.JdbcTemplate;
import com.itany.jdbc.util.RowMapper;
import com.itany.mapper.UserMapper;

import java.util.List;

/**
 * Author：汤小洋
 * Date：2022-11-15 9:31
 * Description：<描述>
 */
public class UserDaoImpl implements UserDao {

    private JdbcTemplate<User> jt = new JdbcTemplate<>();
    private RowMapper<User> rm = new UserMapper();

    @Override
    public List<User> selectAll() {
        String sql = "select id,name,phone,address,status from t_user";
        return jt.query(sql,rm);
    }

    @Override
    public User selectById(int id) {
        return null;
    }

    @Override
    public void insert(User user) {

    }

    @Override
    public void update(User user) {

    }

    @Override
    public void deleteById(int id) {
        String sql = "delete from t_user where id=?";
        jt.update(sql,id);
    }
}
